var purchaseSvc = require("../../services/purchaseSvc");
//乐购首页
exports.index = function (req, res) {
    res.render("purchase/index");
};
//乐购主页接口
exports.getMainList = function (req, res) {
    purchaseSvc.getMainList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购新品
exports.newProduct = function (req, res) {
    res.render("purchase/newProduct");
};
//乐购新品主页接口
exports.getNewMainList = function (req, res) {
    purchaseSvc.getNewMainList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购新品商品列表
exports.getNewProductList = function (req, res) {
    purchaseSvc.getNewProductList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//折扣专场
exports.discount = function (req, res) {
    res.render("purchase/discount");
};
//乐购折扣列表
exports.getDiscountsList = function (req, res) {
    purchaseSvc.getDiscountsList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//幸运秒杀
exports.secondKill = function (req, res) {
    res.render("purchase/secondKill");
};
//乐购秒杀列表
exports.getSeckillALLList = function (req, res) {
    purchaseSvc.getSeckillALLList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//幸福爆款
exports.bursting = function (req, res) {
    res.render("purchase/bursting");
};
//乐购爆款列表
exports.getLuckyBurstALLList = function (req, res) {
    purchaseSvc.getLuckyBurstALLList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//商品分类
exports.goodsClassify = function (req, res) {
    res.render("purchase/goodsClassify");
};
//乐购一级分类
exports.getCategoryList = function (req, res) {
    purchaseSvc.getCategoryList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购子分类
exports.getSubCategoryList = function (req, res) {
    purchaseSvc.getSubCategoryList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//商品分类-商品列表
exports.goodsList = function (req, res) {
    res.render("purchase/goodsList");
};
//乐购子分类商品
exports.getCategoryProductList = function (req, res) {
    purchaseSvc.getCategoryProductList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//商品详情
exports.goodsDetails = function (req, res) {
    res.render("purchase/goodsDetails");
};
//乐购商品详情
exports.getProductById = function (req, res) {
    purchaseSvc.getProductById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购商品评价
exports.getProductCommentById = function (req, res) {
    purchaseSvc.getProductCommentById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-爆款商品详情
exports.getLuckyBurstById = function (req, res) {
    purchaseSvc.getLuckyBurstById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-折扣商品详情
exports.getProductDiscountsById = function (req, res) {
    purchaseSvc.getProductDiscountsById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-秒杀商品详情
exports.getSeckillById = function (req, res) {
    purchaseSvc.getSeckillById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-商品Sku信息
exports.getProductSkuBySku = function (req, res) {
    purchaseSvc.getProductSkuBySku(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//购物车
exports.shoppingCart = function (req, res) {
    res.render("purchase/shoppingCart");
};
//乐购-加入购物车
exports.addCart = function (req, res) {
    purchaseSvc.addCart(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-删除购物车
exports.deleteCartByid = function (req, res) {
    purchaseSvc.deleteCartByid(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-购物车数量
exports.cartCount = function (req, res) {
    purchaseSvc.cartCount(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-购物车列表
exports.cartList = function (req, res) {
    purchaseSvc.cartList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-修改购物车数量
exports.updateCart = function (req, res) {
    purchaseSvc.updateCart(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//确认订单
exports.confirmOrder = function (req, res) {
    res.render("purchase/confirmOrder");
};
//乐购-预下单
exports.preorder = function (req, res) {
    purchaseSvc.preorder(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-购物车是否加入储物箱
exports.cartIsStorage = function (req, res) {
    purchaseSvc.cartIsStorage(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-结算订单
exports.saveOrder = function (req, res) {
    purchaseSvc.saveOrder(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-支付
exports.payOrder = function (req, res) {
    purchaseSvc.payOrder(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//我的订单
exports.myOrder = function (req, res) {
    res.render("purchase/myOrder");
};
//乐购-订单列表
exports.userOrderList = function (req, res) {
    purchaseSvc.userOrderList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//我的订单详情
exports.myOrderInfo = function (req, res) {
    res.render("purchase/myOrderInfo");
};
//乐购-订单详情
exports.userOrderInfo = function (req, res) {
    purchaseSvc.userOrderInfo(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//申请退款
exports.applyRefund = function (req, res) {
    res.render("purchase/applyRefund");
};
//订单申请退款
exports.userOrderRefund = function (req, res) {
    purchaseSvc.userOrderRefund(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//申请退款
exports.applyAftersale = function (req, res) {
    res.render("purchase/applyAftersale");
};
//订单申请退款
exports.userOrderRefundAfter = function (req, res) {
    purchaseSvc.userOrderRefundAfter(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//取消退款
exports.canceluserOrderRefund = function (req, res) {
    purchaseSvc.canceluserOrderRefund(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//取消退货退款
exports.canceluserOrderRefundAndGoods = function (req, res) {
    purchaseSvc.canceluserOrderRefundAndGoods(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//退货物流
exports.returnLogistics = function (req, res) {
    purchaseSvc.returnLogistics(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//拒绝退货
exports.refuseReturnGoods = function (req, res) {
    purchaseSvc.refuseReturnGoods(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//买家取消投诉
exports.canceluserOrderComplaint = function (req, res) {
    purchaseSvc.canceluserOrderComplaint(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//物流信息
exports.logisticsInformation = function (req, res) {
    purchaseSvc.logisticsInformation(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//删除订单
exports.deleteuserOrder = function (req, res) {
    purchaseSvc.deleteuserOrder(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//取消订单
exports.canceluserOrder = function (req, res) {
    purchaseSvc.canceluserOrder(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//确认收货
exports.confirmCollectGoods = function (req, res) {
    purchaseSvc.confirmCollectGoods(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//优惠券
exports.coupon = function (req, res) {
    res.render("purchase/coupon");
};
//优惠券列表
exports.getCouponsByProductId = function (req, res) {
    purchaseSvc.getCouponsByProductId(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//优惠券详情
exports.couponInfo = function (req, res) {
    res.render("purchase/couponInfo");
};
//优惠券详情
exports.getCouponByCouponId = function (req, res) {
    purchaseSvc.getCouponByCouponId(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//购买优惠券
exports.buyCoupon = function (req, res) {
    purchaseSvc.buyCoupon(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//新人专享
exports.newlyweds = function (req, res) {
    res.render("purchase/newlyweds");
};
//获取新人专享类型
exports.getNewUserVip = function (req, res) {
    purchaseSvc.getNewUserVip(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//获取新人专享类型-列表
exports.getNewUserVipList = function (req, res) {
    purchaseSvc.getNewUserVipList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//获取新人专享优惠券详情
exports.getNewUserVipCouponByCouponId = function (req, res) {
    purchaseSvc.getNewUserVipCouponByCouponId(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//购买新人专享优惠券
exports.buyNewUserVipCoupon = function (req, res) {
    purchaseSvc.buyNewUserVipCoupon(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//支付成功
exports.paymentOK = function (req, res) {
    res.render("purchase/paymentOK");
};
//拼团详情
exports.collageInfo = function (req, res) {
    res.render("purchase/collageInfo");
};
//获取拼团详情
exports.getCollageByCouponId = function (req, res) {
    purchaseSvc.getCollageByCouponId(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-购买拼团优惠券
exports.buyCollageByCouponId = function (req, res) {
    purchaseSvc.buyCollageByCouponId(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-拼团-订单详情
exports.getCollageByOrderNumber = function (req, res) {
    purchaseSvc.getCollageByOrderNumber(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//拼团详情-和谁拼团
exports.collageAdd = function (req, res) {
    res.render("purchase/collageAdd");
};
//乐购-拼团
exports.buyCollageByOrderId = function (req, res) {
    purchaseSvc.buyCollageByOrderId(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//拼团-成功
exports.collageOK = function (req, res) {
    res.render("purchase/collageOK");
};
//爆款活动
exports.burstingActivity = function (req, res) {
    res.render("purchase/burstingActivity");
};
//爆款详情
exports.burstingInfo1 = function (req, res) {
    res.render("purchase/burstingInfo1");
};
//爆款详情-分享
exports.burstingInfo = function (req, res) {
    res.render("purchase/burstingInfo");
};
//获取爆款活动类型
exports.getLuckyBurst = function (req, res) {
    purchaseSvc.getLuckyBurst(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//获取爆款活动-列表
exports.getLuckyBurstList = function (req, res) {
    purchaseSvc.getLuckyBurstList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-购买爆款优惠券
exports.buyLuckyBurst = function (req, res) {
    purchaseSvc.buyLuckyBurst(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-爆款优惠-详情
exports.luckyBurstDetail = function (req, res) {
    purchaseSvc.luckyBurstDetail(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-爆款优惠-详情-分享
exports.luckyBurstDetailEx = function (req, res) {
    purchaseSvc.luckyBurstDetailEx(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-爆款优惠-看视频获取能量
exports.getLuckyBurstByAdv = function (req, res) {
    purchaseSvc.getLuckyBurstByAdv(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-爆款优惠-好友点赞获取能量
exports.getLuckyBurstByFriend = function (req, res) {
    purchaseSvc.getLuckyBurstByFriend(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-爆款优惠-好友点赞获取能量-分享
exports.getLuckyBurstByFriendEx = function (req, res) {
    purchaseSvc.getLuckyBurstByFriendEx(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//助力好友
exports.goodFriend = function (req, res) {
    res.render("purchase/goodFriend");
};
//乐购-爆款优惠-助力好友
exports.getLuckyBurstFriends = function (req, res) {
    purchaseSvc.getLuckyBurstFriends(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//活动结束
exports.activityEnd = function (req, res) {
    res.render("purchase/activityEnd");
};
//活动说明
exports.activityExplain = function (req, res) {
    res.render("purchase/activityExplain");
};
//商品搜索历史
exports.shopSearchProductHistory = function (req, res) {
    purchaseSvc.shopSearchProductHistory(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//搜索商品-提示框
exports.searchProduct = function (req, res) {
    purchaseSvc.searchProduct(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//清空搜索历史
exports.emptySearchHistory = function (req, res) {
    purchaseSvc.emptySearchHistory(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-搜索-商品列表
exports.searchProductList = function (req, res) {
    purchaseSvc.searchProductList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺
exports.shopIndex = function (req, res) {
    res.render("purchase/shopIndex");
};
//店铺页
exports.getShopById = function (req, res) {
    purchaseSvc.getShopById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺信息
exports.getShopInfo = function (req, res) {
    purchaseSvc.getShopInfo(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺推荐商品
exports.getShopRemProduct = function (req, res) {
    purchaseSvc.getShopRemProduct(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺-商品页
exports.getShopProduct = function (req, res) {
    purchaseSvc.getShopProduct(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺-热销
exports.getShopProductByOrder = function (req, res) {
    purchaseSvc.getShopProductByOrder(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺-上新页
exports.getShopProductByCreate = function (req, res) {
    purchaseSvc.getShopProductByCreate(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺-收藏店铺
exports.collectShopById = function (req, res) {
    purchaseSvc.collectShopById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//店铺详情
exports.shopDetails = function (req, res) {
    res.render("purchase/shopDetails");
};
//乐购-我的-商品-优惠券列表
exports.getMyCouponsByProductId = function (req, res) {
    purchaseSvc.getMyCouponsByProductId(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//乐购-首页-底部商品列表
exports.bottomProductList = function (req, res) {
    purchaseSvc.bottomProductList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};